<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //作用就是给唯一性场景时   给对象添加属性与方法
        let youxi = {
            name: '狼人杀',
            [Symbol('lianxi')]: function() {
                console.log('我可以练习发言了');
            },
            [Symbol('duoxuexi')]: function() {
                console.log('我吸多学习多进步');
            }

        }
        console.log(youxi); //{name: "狼人杀", Symbol(lianxi): ƒ, Symbol(duoxuexi): ƒ}
        // name: "狼人杀"
        // Symbol(duoxuexi): ƒ()
        // Symbol(lianxi): ƒ()
        // __proto__: Object

        //或者给一个对象添加up  down方法
        let game = {
            name: '这是添加对象方法的属性值',
            up: function() {},
            down: function() {}
        };
        //声明一个对象
        let methods = {
            up: Symbol(),
            down: Symbol()
        };
        game[methods.up] = function() {
            console.log('我可以改变形状了');
        };
        game[methods.up] = function() {
            console.log('我可以快速下降了');
        };
        console.log(game);
    </script>
</body>

</html>